package ddd.ajava.chapter6.question1;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerThread extends Thread{
	private ServerSocket server =null;
	
	public ServerThread(ServerSocket server){
		this.server=server;
	}
	public void run() {
		System.out.println("正在等待。。。");
		Socket socket=null;
		try {
			socket = server.accept();
		} catch (IOException e) {
			e.printStackTrace();
		}
		SocketHandler handler = new SocketHandler(socket);
		Thread thread = new Thread(handler);
		thread.start();
	}
}
